<html>
<head><meta charset="utf-8"><title>Control flow overview? · t-compiler/wg-rustc-dev-guide · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/index.html">t-compiler/wg-rustc-dev-guide</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html">Control flow overview?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226895212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226895212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226895212">(Feb 18 2021 at 22:46)</a>:</h4>
<p>(Related a bit to the recent meeting discussion topic) Especially because of the query system, control flow in the compiler can be... complex. It might be helpful to have a section that explains where "rustc::main" is (both the literal entry point and also where the "real work" begins), and which things happen in what order for a reasonable entry point (let's say from scratch compilation since incremental compilation makes things more complicated). This might also be related to what the actual dynamic extent of the ubiquitous <code>'tcx</code> and <code>'hir</code> lifetimes are (Who actually owns that allocation? When is it cleaned up?). In some ways this is the same AST -&gt; HIR -&gt; MIR -&gt; LLVM pipeline, but due to the on-demand evaluation everything is just a bit on its side, like trying to figure out order of events in a haskell program. Some more clarity here would be great.</p>



<a name="226896162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226896162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226896162">(Feb 18 2021 at 22:55)</a>:</h4>
<p>Seems like a good idea to me.</p>



<a name="226909331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226909331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226909331">(Feb 19 2021 at 01:29)</a>:</h4>
<p><span class="user-mention" data-user-id="271719">@Mario Carneiro</span> does this help? <a href="https://rustc-dev-guide.rust-lang.org/rustc-driver.html">https://rustc-dev-guide.rust-lang.org/rustc-driver.html</a></p>



<a name="226909984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226909984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226909984">(Feb 19 2021 at 01:38)</a>:</h4>
<p>Oh wow, that lead me to this rather imposing doc page -&gt; <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/query/struct.Providers.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/query/struct.Providers.html</a></p>



<a name="226910115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226910115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226910115">(Feb 19 2021 at 01:41)</a>:</h4>
<p>those are <em>all</em> the queries</p>



<a name="226910120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226910120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226910120">(Feb 19 2021 at 01:41)</a>:</h4>
<p>the documentation for them doesn't live there though, it's on <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html</a></p>



<a name="226910124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226910124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226910124">(Feb 19 2021 at 01:41)</a>:</h4>
<p>maybe it would be nice to use the same docs on both TyCtxt and Providers</p>



<a name="226912403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control%20flow%20overview%3F/near/226912403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/Control.20flow.20overview.3F.html#226912403">(Feb 19 2021 at 02:19)</a>:</h4>
<p>Probably it would be better to instead link to the TyCtxt documentation, for example each field on providers links to the corresponding TyCtxt function, because the rustdoc presentation around types with many functions on them is better than giant struct with function pointers of complex types</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>